load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_test")
load("//src/cdk:config.bzl", "CDK_TARGETS")
load("//src/cdk-experimental:config.bzl", "CDK_EXPERIMENTAL_TARGETS")
load("//src/material:config.bzl", "MATERIAL_TARGETS")
load("//src/material-experimental:config.bzl", "MATERIAL_EXPERIMENTAL_TARGETS")
load("//tools:defaults.bzl", "ng_module", "sass_binary", "ts_library")

package(default_visibility = ["//visibility:public"])

ng_module(
    name = "kitchen-sink",
    srcs = [
        "kitchen-sink-mdc/kitchen-sink-mdc.ts",
        "kitchen-sink-root.ts",
        "kitchen-sink/kitchen-sink.ts",
    ],
    assets = [
        "kitchen-sink/kitchen-sink.html",
        "kitchen-sink-mdc/kitchen-sink-mdc.html",
    ],
    deps = [
        "@npm//@angular/platform-server",
        "//src/google-maps",
        "//src/youtube-player",
    ] + CDK_TARGETS + CDK_EXPERIMENTAL_TARGETS + MATERIAL_TARGETS + MATERIAL_EXPERIMENTAL_TARGETS,
)

ts_library(
    name = "server",
    srcs = [
        "prerender.ts",
    ],
    deps = [
        ":kitchen-sink",
        "@npm//@angular/platform-server",
        "@npm//@types/node",
        "@npm//reflect-metadata",
        "@npm//zone.js",
    ],
)

sass_binary(
    name = "theme_scss",
    src = "theme.scss",
    include_paths = [
        "external/npm/node_modules",
    ],
    deps = [
        "//src/material-experimental/mdc-theming:all_themes",
        "//src/material-experimental/mdc-typography:all_typography",
        "//src/material/core:theming_scss_lib",
    ],
)

nodejs_test(
    name = "server_test",
    data = [
        "index.html",
        ":server",
        ":theme_scss",
    ],
    entry_point = ":prerender.ts",
)
